<template>
	<view>
		<picker @change="pickerChange" :mode="modeValue" :value="index" :range="range">
		     <slot></slot>
		     </picker>
	</view>
</template>

<script>
	export default {
		name:"formItem",
		data() {
			return {
				 index:'',
			};
		},
		props:{
			 modeValue:{
			      type:String,
			      default:'selector'
			    },
			    keyValue:String,
			    range:{
			      type:[Array,Object],
			      default:()=>([])
			    }
		},
		onLoad() {
		},
		
		methods:{
			pickerChange(e){
			      let index=e.detail.value;
			        this.index=index;
			      this.$emit('pickerChange',{value:this.range[index],index,keyValue:this.keyValue});
			      
			    },
			  }
		
	}
</script>

<style>

</style>
